package personal.xjl._23java1studentdemo.spring;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Component("myAnotherAdvice")
@Aspect
public class MyAnotherAdvice {
    @After("execution(* MyMath.subtract())")
    public void afterReturning() throws Throwable{
        System.out.println("after returning");
    }
    @Before("execution(* MyMath.add())")
    public void before() throws Throwable{
        System.out.println("before");
    }
    @Around("execution(* MyMath.mul())")
    public Object around(ProceedingJoinPoint pjp) throws Throwable{
        System.out.println("around begin");
        Object result=pjp.proceed();
        System.out.println("around end");
        return result;
    }
}
